$(function () {
    $(window).on("resize",function () {
        let clientW = $(window).width();//获取窗口的宽度
        let isShowBigImage = clientW >= 800;//设置临界值
        let $allItems = $("#lk_carousel .item");//获取所有的item
        $allItems.each(function (index, item) {
            let src = isShowBigImage ? $(item).data("lg-img") : $(item).data("sm-img");
            let imgUrl = 'url(" ' + src +'")';
            $(item).css({
                backgroundImage:imgUrl
            });
            if (!isShowBigImage){
                let $img = "<img src='" + src + "'>";
                $(item).empty().append($img);
            }
            else {
                $(item).empty();
            }
        });
    });
    $(window).trigger("resize");
});